/**
 * @des 注册全局过滤器
 * @author All
 */

import Vue from 'vue'

const filters = {
  /**
   * @description 获取星期
   * @param { string } val 星期对应的值
   */
  getWeekDay: val => {
    const week = parseInt(val)
    if (week === 2) {
      return '周一'
    } else if (week === 3) {
      return '周二'
    } else if (week === 4) {
      return '周三'
    } else if (week === 5) {
      return '周四'
    } else if (week === 6) {
      return '周五'
    } else if (week === 7) {
      return '周六'
    } else if (week === 1) {
      return '周日'
    }
  }
}

for (const key in filters) {
  Vue.filter(key, filters[key])
}
